//
//  AFFManger.h
//  CasualPay
//
//  Created by LiuYongfu on 15/10/21.
//
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"
#import "JSONModel.h"

typedef void (^RequestSuccessed)(NSString *message , id responseObject);
typedef void (^RequestFailure)(NSInteger errorCode, NSString *errorMessage);

typedef NS_ENUM (NSInteger, RequestType) {
    RequestTypeGET = 0,
    RequestTypePOST,
    RequestTypeUploadFile,
    RequestTypePostBodyData
};


@interface AFFManger : NSObject

#pragma mark - 最常用的GET和POST
+ (NSURLSessionDownloadTask *)downloadFileWithOption:(NSDictionary *)paramDic requestURL:(NSString*)requestURL savedPath:(NSString*)savedPath progress:(void (^)(NSProgress *progress))progress downloadSuccess:(void (^)(id responseObject))success downloadFailure:(void (^)(NSError *error))failure;

+ (void)getDataWithAPI:(NSString *)apiName
         andArrayParam:(NSArray *)arrayParam
          andDictParam:(NSDictionary *)dictParam
             dataModel:(NSString *)modelName
         isShowLoading:(BOOL)isShowLoading
      requestSuccessed:(RequestSuccessed)requestSuccessed
        requestFailure:(RequestFailure)requestFailure;

+ (void)getDataWithAPI:(NSString *)apiName
		 andArrayParam:(NSArray *)arrayParam
		  andDictParam:(NSDictionary *)dictParam
			 dataModel:(NSString *)modelName
		 isShowLoading:(BOOL)isShowLoading
	   requestSuccessed:(RequestSuccessed)requestSuccessed
		requestFailure:(RequestFailure)requestFailure
		sender: (id)Sender;

+ (void)postDataWithAPI:(NSString *)apiName
          andArrayParam:(NSArray *)arrayParam
           andDictParam:(NSDictionary *)dictParam
              dataModel:(NSString *)modelName
          isShowLoading:(BOOL)isShowLoading
       requestSuccessed:(RequestSuccessed)requestSuccessed
requestFailure:(RequestFailure)requestFailure;

+ (void)postDataWithAPISub:(NSString *)apiName
             andArrayParam:(NSArray *)arrayParam
              andDictParam:(NSDictionary *)dictParam
                 dataModel:(NSString *)modelName
             isShowLoading:(BOOL)isShowLoading
          requestSuccessed:(RequestSuccessed)requestSuccessed
            requestFailure:(RequestFailure)requestFailure;

+ (void)postDataWithAPI:(NSString *)apiName
		  andArrayParam:(NSArray *)arrayParam
		   andDictParam:(NSDictionary *)dictParam
			  dataModel:(NSString *)modelName
		  isShowLoading:(BOOL)isShowLoading
	   requestSuccessed:(RequestSuccessed)requestSuccessed
		 requestFailure:(RequestFailure)requestFailure
		sender: (id)Sender;

+ (void)postBodyDataWithAPI:(NSString *)apiName
              andArrayParam:(NSArray *)arrayParam
               andDictParam:(NSDictionary *)dictParam
               andBodyParam:(NSString *)bodyParam
                  dataModel:(NSString *)modelName
              isShowLoading:(BOOL)isShowLoading
           requestSuccessed:(RequestSuccessed)requestSuccessed
             requestFailure:(RequestFailure)requestFailure;

#pragma mark - 自定义url前缀的GET和POST

+ (void)getDataToUrl:(NSString *)url
               withAPI:(NSString *)apiName
         andArrayParam:(NSArray *)arrayParam
          andDictParam:(NSDictionary *)dictParam
             dataModel:(NSString *)modelName
         isShowLoading:(BOOL)isShowLoading
      requestSuccessed:(RequestSuccessed)requestSuccessed
        requestFailure:(RequestFailure)requestFailure;

+ (void)postDataToUrl:(NSString *)url
              withAPI:(NSString *)apiName
        andArrayParam:(NSArray *)arrayParam
         andDictParam:(NSDictionary *)dictParam
            dataModel:(NSString *)modelName
        isShowLoading:(BOOL)isShowLoading
     requestSuccessed:(RequestSuccessed)requestSuccessed
       requestFailure:(RequestFailure)requestFailure;

+ (void)postBodyDataToUrl:(NSString *)url
                  withAPI:(NSString *)apiName
            andArrayParam:(NSArray *)arrayParam
             andDictParam:(NSDictionary *)dictParam
             andBodyParam:(NSString *)bodyParam
                dataModel:(NSString *)modelName
            isShowLoading:(BOOL)isShowLoading
         requestSuccessed:(RequestSuccessed)requestSuccessed
           requestFailure:(RequestFailure)requestFailure;

#pragma mark - 通用的GET和POST（只返回BaseModel的Data内容）
/**
 *  只返回BaseModel的Data内容
 *
 *  @param url              <#url description#>
 *  @param apiName          <#apiName description#>
 *  @param arrayParam       <#arrayParam description#>
 *  @param dictParam        <#dictParam description#>
 *  @param bodyParam        <#bodyParam description#>
 *  @param modelName        <#modelName description#>
 *  @param requestType      <#requestType description#>
 *  @param requestSuccessed <#requestSuccessed description#>
 *  @param requestFailure   <#requestFailure description#>
 */
+ (void)requestByUrl:(NSString *)url
             withAPI:(NSString *)apiName
       andArrayParam:(NSArray *)arrayParam
        andDictParam:(NSDictionary *)dictParam
        andBodyParam:(NSString *)bodyParam
           dataModel:(NSString *)modelName
         requestType:(RequestType)requestType
       isShowLoading:(BOOL)isShowLoading
    requestSuccessed:(RequestSuccessed)requestSuccessed
      requestFailure:(RequestFailure)requestFailure;

#pragma mark - 通用的GET、POST 和 上传图片（返回BaseModel的所有内容）
/**
 *  返回BaseModel的所有内容
 *
 *  @param url              <#url description#>
 *  @param apiName          <#apiName description#>
 *  @param arrayParam       <#arrayParam description#>
 *  @param dictParam        <#dictParam description#>
 *  @param bodyParam        <#bodyParam description#>
 *  @param imageData        <#imageData description#>
 *  @param requestType      <#requestType description#>
 *  @param requestSuccessed <#requestSuccessed description#>
 *  @param requestFailure   <#requestFailure description#>
 */
+ (void)requestByUrl:(NSString *)url
             withAPI:(NSString *)apiName
       andArrayParam:(NSArray *)arrayParam
        andDictParam:(NSDictionary *)dictParam
        andBodyParam:(NSString *)bodyParam
           imageData:(NSData *)imageData
         requestType:(RequestType)requestType
       isShowLoading:(BOOL)isShowLoading
    requestSuccessed:(RequestSuccessed)requestSuccessed
      requestFailure:(RequestFailure)requestFailure;

#pragma mark - 通用的GET、POST 和 上传图片（不用数据模型返回字典）
/**
 *  通过字典返回时候数据
 *
 *  @param url              <#url description#>
 *  @param apiName          <#apiName description#>
 *  @param arrayParam       <#arrayParam description#>
 *  @param dictParam        <#dictParam description#>
 *  @param bodyParam        <#bodyParam description#>
 *  @param imageData        <#imageData description#>
 *  @param requestType      <#requestType description#>
 *  @param requestSuccessed <#requestSuccessed description#>
 *  @param requestFailure   <#requestFailure description#>
 */
+ (void)requestDataForDicByUrl:(NSString *)url
             withAPI:(NSString *)apiName
       andArrayParam:(NSArray *)arrayParam
        andDictParam:(NSDictionary *)dictParam
        andBodyParam:(NSString *)bodyParam
           imageData:(NSData *)imageData
         requestType:(RequestType)requestType
                 isShowLoading:(BOOL)isShowLoading
    requestSuccessed:(RequestSuccessed)requestSuccessed
      requestFailure:(RequestFailure)requestFailure;



@end
